<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>课程统计总览</title>
	<link rel="stylesheet" type="text/css" href="/static/css/hw-admin.css">
	<link rel="stylesheet" href="/static/css/lb.css"> 
    <style>
        .flex div {
            display: flex;
            align-items: center;
        }
        .flex div span:nth-child(1) {
            flex: 1;
        }
    </style>
    <!--[if lt IE 9]>
    　 <script src="/static/lib/html5shiv.min.js" type="text/javascript"></script>
       <script src="/static/lib/selectivizr.min.js" type="text/javascript"></script>
    <![endif]-->  
</head>

<body>
        <div class="hw-iframe">
            <div class="hw-header-wrapper">
                <div class="hw-header">
                    <div class="hw-header__item--left">
                        发票列表
                    </div>
                </div>
            </div>
            <div class="hw-filter-wrapper">
                <div class="hw-filter">
                    <form method="GET" action="<?=$url ?>">
                        <div class="default-filter"> 
                            <div class="hw-input-label"> 
                                <div class="form-control">
                                    <div class="hw-search-prevent">
                                        <input type="text" id="company-name" class="hw-input" placeholder="请输入房间号、发票抬头、税号" name="keyword" value="<?=isset($_GET['keyword'])?$_GET['keyword']:''?>">
                                        <input name="status" type="text" hidden value="<?=isset($_GET['status'])?$_GET['status']:''?>">
                                        <input name="live_type" type="text" hidden value="<?=isset($_GET['live_type'])?$_GET['live_type']:''?>">
                                        <button class="search-btn" type="submit"><i class="iconfont"></i></button>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" id="screen" value="" name="type">
                            <input type="hidden" id="live_type" value="" name="live_type">
                            <div class="filter-switch" data-status="">更多筛选条件<i style="transform: scale(0.56);" class="iconfont hw-down">&#xe87d;</i><i  style="transform: scale(0.56);" class="iconfont hw-up hide">&#xe87e;</i></div>
                        </div>
                        <div class="filter-detail" <?=isset($_GET['start_time'])||isset($_GET['end_time'])?'style="display:block;"':''?>>
                            <div class="filter-item">
                                <div class="hw-input-label">
                                    <label class="name" for="">申请时间</label>
                                    <div class="input-icon-group">
                                        <input type="text" id="startime"  onclick="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\',{d: -1})||\'%y-%M-{%d-1}\'}'})"  placeholder="选择日期" name="start_time" value="<?=isset($_GET['start_time'])&&$_GET['start_time']!=''?$_GET['start_time']:''?>">
                                        <div class="icon-wrapper">
                                            <i class="iconfont">&#xe601;</i>
                                        </div>
                                    </div>
                                </div>

                                <div class="hw-input-label">
                                    <label class="name" for="" style="width: 34px;text-align: center;">——</label>
                                    <div class="input-icon-group">
                                        <input type="text" id="endtime"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'startime\',{d:1});}',maxDate: '%y-%M-%d'})"  placeholder="选择日期" name="end_time" value="<?=isset($_GET['end_time'])&&$_GET['end_time']!=''?$_GET['end_time']:''?>">
                                        <div class="icon-wrapper">
                                            <i class="iconfont">&#xe601;</i>
                                        </div>
                                    </div>
                                </div>
                                <div class="operate-btns">
                                    <div style="float: left;" class="hw-btn hw-default-btn reset_form"><i style="font-size: 13px;position: relative;left: -2px;" class="iconfont">&#xe629;</i>重置</div>
                                    <button class="hw-btn"><i class="iconfont">&#xe9df;</i>查询</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="tab-wrap">
                <ul class="hw-nav-tabs">
                <a href="<?=base_url().'HotelAdmin/Invoice/invoiceList?status=0'?>">
                    <!-- <li data-toggle="tab" class="active" onclick="$('.form-one').show().siblings('.form-two').hide();">待开票</li> -->
                    <li data-toggle="tab"  <?=(!isset($_GET['status']))||(isset($_GET['status'])&&$_GET['status']==0)?'class="active"':''?>>待开票</li>
                </a>
                <a href="<?=base_url().'HotelAdmin/Invoice/invoiceList?status=1'?>">
                    <!-- <li data-toggle="tab" onclick="$('.form-one').hide().siblings('.form-two').show();">已开票</li> -->
                    <li data-toggle="tab" <?=isset($_GET['status'])&&$_GET['status']==1?'class="active"':''?>>已开票</li>
                </a>
                </ul>
            </div>

            <div class="main-table-wrap form-one" <?=(!isset($_GET['status']))||(isset($_GET['status'])&&$_GET['status']==0)?'':'style="display: none;"'?>>
                <form id="table-form-one" method="POST" action="">
                    <table cellspacing="0" cellpadding="0" border="0">  
                        <colgroup>
                            <col class="col-3">
                            <col class="col-4">
                            <col class="col-5">
                            <col class="col-7">
                            <col class="col-6">
                            <col class="col-7">
                            <col class="col-4"> 
                            <col class="col-4">
                            <col class="col-8">
                            <col class="col-7">
                        </colgroup>

                        <thead>
                            <tr>
                            
                                <th>序号</th>
                                <th>房间号</th>
                                <th>发票抬头</th>
                                <th>发票税号</th>
                                <th class="hover-th">
                                    <span><?php if(isset($_GET['type'])&&$_GET['type'] == '0'){echo '增值税专用发票';}elseif(isset($_GET['type'])&&$_GET['type']==1){echo '普通发票';}else{echo '发票类型';}?><i class="iconfont"></i></span>
                                    <div class="hover-content"> 
                                        <ul class="info" data-target="#screen"> 
                                            <li class="list <?=(!isset($_GET['type']))||(isset($_GET['type'])&&$_GET['type']=='')?'active':''?>" data-value="">全部</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']=='0'?'active':''?>" data-value="0">增值税专用发票</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==1?'active':''?>" data-value="1">普通发票</li>
                                        </ul>
                                    </div>
                                </th>
                                <th class="hover-th">
                                    <span><?php if(isset($_GET['live_type'])&&$_GET['live_type'] == 1){echo '前台办理';}elseif(isset($_GET['live_type'])&&$_GET['live_type']==2){echo '自动机办理';}elseif(isset($_GET['live_type'])&&$_GET['live_type']==3){echo '未知';}else{echo '入住方式';}?><i class="iconfont"></i></span>
                                    <div class="hover-content"> 
                                        <ul class="info" data-target="#live_type"> 
                                            <li class="list <?=(!isset($_GET['live_type']))||(isset($_GET['live_type'])&&$_GET['live_type']=='')?'active':''?>" data-value="">全部</li>
                                            <li class="list <?=isset($_GET['live_type'])&&$_GET['live_type']==1?'active':''?>" data-value="1">前台办理</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==2?'active':''?>" data-value="2">自助机办理</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==3?'active':''?>" data-value="3">未知</li>
                                        </ul>
                                    </div>
                                </th>
                                <th>发票金额</th>
                                <th>备注</th>
                                <th>申请时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>                     

                        <tbody>
                        <?php if(isset($list) && count($list)!=0){
                            foreach ($list as $key => $value) {
                                ?>
                            <tr>
                                <td><?=$key+1?></td>
                                <td><?=isset($value['roomNumber'])?$value['roomNumber']:''?></td>
                                <td class="flex"><div><span><?=isset($value['rise'])?$value['rise']:''?></span><?php if(isset($value['rise']) && $value['rise']!=""){?><span style="float: right;margin-right: 8px;cursor: pointer;" class="copy blue-color">复制<?php }?></span></div></td>
                                <td class="flex"><div><span><?=isset($value['duty_num'])?$value['duty_num']:''?></span><?php if(isset($value['duty_num']) && $value['duty_num']!="") {?><span style="float: right;margin-right: 8px;cursor: pointer;"  class="copy blue-color">复制</span><?php }?></div></td>
                                <td>
                                    <span><?=$value['type']=='0'?'专票':'普票'?></span>
                                </td>
                                <td><?=isset($value['checkIn'])?$value['checkIn']:''?></td>
                                <td><?=isset($value['price'])?$value['price']:''?></td>
                                <td><?=isset($value['note'])?$value['note']:''?></td>
                                <td><?=$value['create_time']?></td>
                                <td class="opt">
                                    <a class="blue-color" href="<?=base_url().'HotelAdmin/Invoice/invoiceDetail/'.$value['id']?>"><i style="margin-right: 3px;" class="iconfont">&#xe6f4;</i>查看</a>
                                    <a class="blue-color" href="<?=base_url().'HotelAdmin/Invoice/invoiceFinish/'.$value['id']?>"><i style="margin-right: 3px;" class="iconfont">&#xe66e;</i>开票</a>
                                </td>
                            </tr>
                        <?php
                            }
                        }?>
                        </tbody>
                    </table>
                </form>
                <?php $this->load->view('Admin/Page/page'); ?>
            </div>

            <div class="main-table-wrap form-two" <?=isset($_GET['status'])&&$_GET['status']==1?'':'style="display: none;"'?>>
                <form id="table-form-one" method="POST" action="">
                    <table cellspacing="0" cellpadding="0" border="0">  
                        <colgroup>
                            <col class="col-3">
                            <col class="col-4">
                            <col class="col-5">
                            <col class="col-7">
                            <col class="col-6">
                            <col class="col-7">
                            <col class="col-4"> 
                            <col class="col-4">
                            <col class="col-8">
                            <col class="col-7">
                        </colgroup>

                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>房间号</th>
                                <th>发票抬头</th>
                                <th>发票税号</th>
                                <th class="hover-th">
                                    <span><?php if(isset($_GET['type'])&&$_GET['type'] == '0'){echo '增值税专用发票';}elseif(isset($_GET['type'])&&$_GET['type']==1){echo '普通发票';}else{echo '发票类型';}?><i class="iconfont"></i></span>
                                    <div class="hover-content"> 
                                        <ul class="info" data-target="#screen"> 
                                            <li class="list <?=(!isset($_GET['type']))||(isset($_GET['type'])&&$_GET['type']=='')?'active':''?>" data-value="">全部</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']=='0'?'active':''?>" data-value="0">增值税专用发票</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==1?'active':''?>" data-value="1">普通发票</li>
                                        </ul>
                                    </div>
                                </th>
                                <th class="hover-th">
                                    <span><?php if(isset($_GET['live_type'])&&$_GET['live_type'] == 1){echo '前台办理';}elseif(isset($_GET['live_type'])&&$_GET['live_type']==2){echo '自动机办理';}elseif(isset($_GET['live_type'])&&$_GET['live_type']==3){echo '未知';}else{echo '入住方式';}?><i class="iconfont"></i></span>
                                    <div class="hover-content"> 
                                        <ul class="info" data-target="#live_type"> 
                                            <li class="list <?=(!isset($_GET['live_type']))||(isset($_GET['live_type'])&&$_GET['live_type']=='')?'active':''?>" data-value="">全部</li>
                                            <li class="list <?=isset($_GET['live_type'])&&$_GET['live_type']==1?'active':''?>" data-value="1">前台办理</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==2?'active':''?>" data-value="2">自助机办理</li>
                                            <li class="list <?=isset($_GET['type'])&&$_GET['type']==3?'active':''?>" data-value="3">未知</li>
                                        </ul>
                                    </div>
                                </th>
                                <th>发票金额</th>
                                <th>备注</th>
                                <th>申请时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>                     

                        <tbody>
                        <?php if(isset($list) && count($list)){
                            foreach ($list as $key => $value) {
                                ?>
                            <tr>
                                <td><?=$key+1?></td>
                                <td><?=isset($value['roomNumber'])?$value['roomNumber']:''?></td>
                                <td  class="flex"><div><span><?=isset($value['rise'])?$value['rise']:''?></span><?php if(isset($value['rise']) && $value['rise']!=""){?><span style="float: right;margin-right: 8px;cursor: pointer;" class="copy blue-color">复制</span><?php }?></div></td>
                                <td  class="flex"><div><span><?=isset($value['duty_num'])?$value['duty_num']:''?></span><?php if(isset($value['duty_num']) && $value['duty_num']!=""){?><span style="float: right;margin-right: 8px;cursor: pointer;"  class="copy blue-color">复制</span><?php }?></div></td>
                                <td>
                                    <span><?=$value['type']=='0'?'专票':'普票'?></span>
                                </td>
                                <td><?=isset($value['checkIn'])?$value['checkIn']:''?></td>
                                <td><?=isset($value['price'])?$value['price']:''?></td> 
                                <td><?=isset($value['note'])?$value['note']:''?></td>
                                <td><?=isset($value['create_time'])?$value['create_time']:''?></td>
                                <td class="opt">
                                    <a class="blue-color" href="<?=base_url().'HotelAdmin/Invoice/invoiceDetail/'.$value['id']?>"><i style="margin-right: 3px;" class="iconfont">&#xe6f4;</i>查看</a>
                                </td>
                            </tr>
                        <?php
                            }
                        }?>
                        </tbody>
                    </table>
                </form>
                <?php $this->load->view('Admin/Page/page'); ?>
            </div>
           
        </div>
        
    

	<script src="/static/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/static/js/common/util.js"></script>
	<script type="text/javascript" src="/static/js/common/upload.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.validate.js"></script>
	<script type="text/javascript" src="/static/lib/messages_zh.js"></script>
	<script type="text/javascript" src="/static/js/common/validateExtend.js"></script>
	<script type="text/javascript" src="/static/js/common/common.js"></script>
    <!-- <script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/addCustomizeDialog.js"></script> -->
    <script>
        var imgModal = $('#img-modal');
        function createPreviewModal(url) {
        if(!url||url==''){
            return;
        }
        var str;
		if (imgModal.length > 0) {
			imgModal.find('.modal-body').find('img').attr('src', url);
			imgModal.removeClass('hide');
			return;
		} 

		str = '<div class="modal hide" id="img-modal">'+
				    '<div class="modal-mask"></div>'+
				    '<div class="modal-content">'+
				        '<div class="modal-header">'+
				            '<i class="iconfont" data-dismiss="modal">&#xe63d;</i>'+
				            '<div class="modal-title">图片预览</div>'+
				        '</div>'+
				        '<div class="modal-body">'+
				        	'<img class="preview-img-box" src="'+ url +'">'+
				        '</div>'+ 
				    '</div>'+
				'</div>';
		$('body').append(str);
		setTimeout(function() {
			imgModal = $('#img-modal');
			imgModal.removeClass('hide');
		}, 20);
    }
    

    function copyArticle(that) {
        const range = document.createRange();
        range.selectNode(that.prev()[0]);
        const selection = window.getSelection();
        if(selection.rangeCount > 0) selection.removeAllRanges();
        selection.addRange(range);
        document.execCommand('copy');
        $.alert("复制成功！");
    }
    $('.copy').on('click',function(){
        var that = $(this);
        copyArticle(that);
    })
    </script>
</body>
</html>
